<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>bb管理系统</title>
	</head>
	<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
		
		<link rel="stylesheet" href="/static/home/css/1.css"/>
	<body>
		
                         
                  
                  <div class="container-fluid">
                         	
                         	
                         	<div class="mainpage1">
                        <a style="color: darkgray;">商品管理</a>
                        <span style="color: black;">
                        	>
                        </span>
                        <a style="color: darkgray;">商品分类</a>
                    </div>
                    </div>
                  
                  
                  
                 
                   
                   <div class="container-fluid">
                         	
                         	
                         	<div class="mainpage">
                        <div class="row">
                        	
                       <a href="address_add.html"><input type="button" name="" id="" value="新增" /></a>
                        </div>
                    </div>
                    </div>
                        
                        
                        
                        
                                  
                                    
                        
                        <div class="col4">
                            <div class="intermediate-card">
                                
                                <div
                                    class="card-header d-flex">
                                    <h6 class="m-0 font-weight-bold text-primary">系统信息</h6>
                                    
                                </div>
                                
                                
                                
                                
                                <!-- 数据主体 -->
                                <div class="my">
                                    <table class="linear" cellspacing="0px">
										<thead>
                                    	<tr>
											<td>+</td>
											<td>id</td>
                                    		<td>分类名称</td>
                                    		<td>操作
                                    		</td>
                                    	
										</tr>
										</thead>
										<tbody>

										{foreach $list as $v}
                                    	<tr class="date">
                                    		<td class="ee"><input type="button" value="+"></td>
                                    		<td class="id">{$v.id}</td>
                                    		<td>{$v.cate_name}</td>
                                    		
                                    		
                                    		<td><a href="address_edit.html"><button class="but">修改</button></a>
                                    			
                                    			<a href="#"><button class="but1">删除</button></a>
                                    		</td>
                                    		
                                    	</tr>
										{foreach $v['son'] as $item}
										<tr class="date2" style="display: none;" pid="{$item.pid}">
											
												<td>{$item.id}</td>
												<td>{$item.cate_name}</td>
												
												
												<td><a href="address_edit.html"><button class="but">修改</button></a>
													
													<a href="#"><button class="but1">删除</button></a>
												</td>
												
											</tr>
											
											{/foreach}
                                    	{/foreach}
										</tbody>
                                    </table>
                                    
                                </div>
							</div>
							<div class="ddd">
                                    	
								</div>
                        </div>
                        
	    </div>
	    

	<script type="text/javascript" src="/static/home/js/jquery-1.12.1.js"></script>
		
	
		<script src="vendor/jquery/jquery.min.js"></script>
    <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
    
    <script type="text/javascript">
    	$(function(){
    		$(".ee>input").click(function(){
    			if($(this).val()=='+')
    			{
//  				console.log($(this).parent().parent().nextAll());
					var id=$(this).parent().parent().find('.id').text();
					var tr=$('tbody tr');
					console.log(id);
					for(var i=0;i<tr.length;i++){
						if(id==tr[i].getAttribute('pid')){

							tr[i].removeAttribute('style');
							$(this).attr("value",'-');
						}
					}
    				// $(this).parent().parent().nextAll('.date2').removeAttr('style');
    				// $(this).attr("value",'-');
    			}else{
    				$(this).parent().parent().nextAll('.date2').css('display','none');
    				$(this).attr("value",'+');
    			}
    			
    			// $('.ll>input').click(function(){
    			// 	if($(this).val()=='+'){
    			// 		$(this).parent().parent().nextAll('.date3').removeAttr('style');
    			// 		$(this).attr("value",'-');
    			// 	}else{
    			// 		$(this).parent().parent().nextAll('.date3').css('display','none');
    			// 	$(this).attr("value",'+');
    			// 	}
    			// })
    		})
    	})
    </script>
	</body>
</html>
